package com.itlong.cloud.POJO.VO.property;

import com.itlong.cloud.utils.date.DateUtil;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang.StringUtils;

import java.text.ParseException;
import java.util.Date;

/**
 * <desc>
 *      门禁临时权限VO类
 * </desc>
 *
 * @createDate 2019/09/11
 */
@Data
@NoArgsConstructor
public class ElevatorTempAuthVO {
    private String userId;            //用户id
    private String userName;         //用户名称
    private String idcardKey;        //身份证
    private Integer visitorType;  //是否为访客 1是 0否
    private String startTime;       //开始时间
    private String endTime;         //结束时间
    private String isLoss;          //挂失状态 0正常 1挂失
    private String floor;      //楼层权限
    private String status;      //状态 0禁用 1正常

    public void setStartTime(String startTime) throws ParseException {
        try {
            if (StringUtils.isNotBlank(startTime)) {
                this.startTime = DateUtil.fomatDate(DateUtil.formatStringToDate(startTime, DateUtil.DATE_FORMAT_TYPE1), DateUtil.YYMMDDHHMMSS2);
            }
        }catch (Exception e){
            this.startTime = startTime;
        }
    }

    public void setEndTime(String endTime) throws ParseException {
        try {
            if (StringUtils.isNotBlank(endTime)) {
                this.endTime = DateUtil.fomatDate(DateUtil.formatStringToDate(endTime, DateUtil.DATE_FORMAT_TYPE1), DateUtil.YYMMDDHHMMSS2);
            }
        }catch (Exception e){
            this.endTime = endTime;
        }
    }

}